package com.data;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class BookFileDataSet implements DataSet {
	private String path = null;
	private BufferedReader br;

	public BookFileDataSet(String path) {
		this.path = path;
	}

	public boolean openDataSource() {

		try {
			FileReader fr = new FileReader(path);
			br = new BufferedReader(fr);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return false;
	}

	public boolean haveNext() {
		// TODO Auto-generated method stub
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return false;
	}

	public Object next() {
		// TODO Auto-generated method stub
		try {
			return br.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public boolean close() {
		// TODO Auto-generated method stub
		try {
			br.close();
			return true;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public String getDatasourceFilePath() {
		// TODO Auto-generated method stub
		return path;
	}

}
